local pochen = fk.CreateSkill{
    name = "ym2__pochen",
    dynamic_desc = function (self, player, lang)
        if Fk:currentRoom():isGameMode("1v2_mode") or Fk:currentRoom():isGameMode("rmt__1v2_mode") or Fk:currentRoom():isGameMode("fuyao_1v2_mode") then
            return "你触发最中间的其他技能后，可视为使用无距离次数限制的【杀】；若触发的技能为“乜日”，则此牌不可被响应。"
        else
            return  "你触发唯一最中间的其他技能后，可将一张牌当做无距离次数限制的【杀】使用；若触发的技能为“乜日”，则此牌不可被响应。"
        end
    end,
}
Fk:loadTranslationTable{
    ["ym2__pochen"] = "破宸",
    [":ym2__pochen"] = "你触发唯一最中间的其他技能后，可将一张牌当做无距离次数限制的【杀】使用；若触发的技能为“乜日”，则此牌不可被响应。",
    ["#ym2__pochen-invoke"] = "是否发动 破宸，将一张牌当做无距离次数限制的【杀】使用",
    ["#ym2__pochen-use"] = "是否发动 破宸，将一张牌当做无距离次数限制的【杀】使用（不可响应）",
    ["#ym2__pochen-invoke2"] = "是否发动 破宸，视为使用无距离次数限制的【杀】",
    ["#ym2__pochen-use2"] = "是否发动 破宸，视为使用无距离次数限制的【杀】（不可响应）",
    ["@[ym2__pochen]"] = "破宸",

    ["$ym2__pochen1"] = "谬论谶语，何需二矢，吾一箭破之。",
    ["$ym2__pochen2"] = "军旅无阻，泥池无木，子可抱地而泣。",
}
Fk:addQmlMark{
    name = "ym2__pochen",
    how_to_show = function (name, value, player)
        local skills = {}
        for _, skill in ipairs(player.player_skills) do
            local skill_name = skill.name
            local str = Fk:translate(":"..skill_name,"zh_CN")
            if str and str ~= "" and not string.find(skill_name,"#") and skill:isPlayerSkill(player) and not skill:isEquipmentSkill(player) then
                table.insertIfNeed(skills,skill_name)
            end
        end
        if #skills%2==0 then
            if Fk:currentRoom():isGameMode("1v2_mode") or Fk:currentRoom():isGameMode("rmt__1v2_mode") or Fk:currentRoom():isGameMode("fuyao_1v2_mode") then
                return table.concat(table.map({skills[#skills/2],skills[(#skills/2)+1]},function(element,index)
                    return "<font color='#6fb8cc'>" .. Fk:translate(element) .. "</font>"
                end)," ")
            else
                return "无"
            end
        else
            return "<font color='#6fb8cc'>"..Fk:translate(skills[(#skills+1)/2],"zh_CN").."</font>"
        end
    end,
    qml_path = " ",
}
pochen:addEffect(fk.AfterSkillEffect,{
    can_trigger = function (self, event, target, player, data)
        if player:hasSkill(pochen.name) and target == player and data and data.skill:getSkeleton().name ~= pochen.name then
            local skills = {}
            for _, skill in ipairs(player.player_skills) do
                local name = skill.name
                local str = Fk:translate(":"..name,"zh_CN")
                if str and str ~= "" and not string.find(name,"#") and skill:isPlayerSkill(player) and not skill:isEquipmentSkill(player) then
                    table.insertIfNeed(skills,name)
                end
            end
            if #skills%2==0 then
                local room = player.room
                if room:isGameMode("1v2_mode") or room:isGameMode("rmt__1v2_mode") or room:isGameMode("fuyao_1v2_mode") then
                    return skills[#skills/2] == data.skill:getSkeleton().name or skills[(#skills/2)+1] == data.skill:getSkeleton().name
                else
                    return false 
                end
            else
                return skills[(#skills+1)/2] == data.skill:getSkeleton().name
            end
        end
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local prompt = "#ym2__pochen-invoke"
        local num = 1
        if room:isGameMode("1v2_mode") or room:isGameMode("rmt__1v2_mode") or room:isGameMode("fuyao_1v2_mode") then
            num = 0
            if data.skill:getSkeleton().name == "ym2__mieri" then
                prompt = "#ym2__pochen-use2"
            else
                prompt = "#ym2__pochen-invoke2"
            end
        else
            if data.skill:getSkeleton().name == "ym2__mieri" then
                prompt = "#ym2__pochen-use"
            end
        end
        local use = player.room:askToUseVirtualCard(player, {
            name = "slash",
            skill_name = pochen.name,
            prompt = prompt,
            cancelable = true,
            card_filter = {
                n = num,
                cards = player:getCardIds("he"),
            },
            skip = true,
            extra_data = {
                bypass_distances = true,
                bypass_times = true,
            }
        })
        if use then
            event:setCostData(self,use)
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local use = event:getCostData(self)
        if data.skill:getSkeleton().name == "ym2__mieri" then
            use.disresponsiveList = table.simpleClone(room.players)
        end
        room:useCard(use)
    end,
})
pochen:addAcquireEffect(function (self, player, is_start)
    player.room:setPlayerMark(player,"@[ym2__pochen]",1)
end)
pochen:addLoseEffect(function (self, player, is_death)
    player.room:setPlayerMark(player,"@[ym2__pochen]",0)
end)
return pochen